
package com.kanjian.music.util;

import android.content.Context;
import android.content.res.Resources;
import android.util.TypedValue;

import com.kanjian.music.KanjianApplication;

/*
 * 尺寸转换工具类
 */
public class PixUtil {

    private static Context mContext = KanjianApplication.getContext();

    private static Resources mResources;

    public static float getRawSize(int unit, float size) {
        if (mContext == null) {
            mContext = KanjianApplication.getContext();
        }
        if (mContext == null) {
            mResources = Resources.getSystem();
        } else {
            mResources = mContext.getResources();
        }
        return TypedValue.applyDimension(unit, size, mResources.getDisplayMetrics());
    }

}
